<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="/js/bootstrap.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <title>Document</title>
    <style>
        aside {
            background-color: #2e3f50;
            width: 15%;
            height: 100vh;
            float: left;
            color: #fff;
            padding: 30px;
            display: flex;
            flex-direction: column;
            justify-content: start;
            align-items: center;
        }

        header {
            width: 85%;
            background-color: #5268b7;
            color: #fff;
            height: 70px;
            float: right;
            border-radius: 2px;
        }

        .name {
            margin: 10px 0;
            line-height: 60px;
        }

        aside a {
            color: #fff;
        }
        aside a:hover {
            color: #999;
            text-shadow: 3px 3px 5px #000;
        }
        aside a.active {
            color: #999;
            text-shadow: 3px 3px 5px #000;
        }

        main {
            width: 85%;
            float: right;
        }
    </style>
</head>
<body>

<aside class="shadow">
    <p class="h3">smbms</p>
    <p class="name"><span th:text="${session.username}">李明</span></p>
    <nav class="nav flex-column">
        <a class="nav-link " href="/home">
            <i class="bi bi-house-door-fill"></i>
            <span>首页</span>
        </a>
        <a class="nav-link" href="/showUser">
            <i class="bi bi-people-fill"></i>
            <span>用户管理</span>
        </a>
        <a class="nav-link" href="/showBill">
            <i class="bi bi-receipt-cutoff"></i>
            <span>账单管理</span>
        </a>
        <a class="nav-link active" href="#">
            <i class="bi bi-cart-fill"></i>
            <span>供应商管理</span>
        </a>
        <a class="nav-link" href="/editPasswordHTML">
            <i class="bi bi-gear-fill"></i>
            <span>个人设置</span>
        </a>
        <a class="nav-link" href="/quit">
            <i class="bi bi-box-arrow-left"></i>
            <span>退出</span>
        </a>
    </nav>
</aside>

<header class="navbar shadow">
    <h3>超市账单管理系统</h3>
</header>

<main>
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="/showUser">首页</a></li>
            <li class="breadcrumb-item active" aria-current="page">供应商管理</li>
        </ol>
    </nav>

    <div class="jumbotron" style="padding: 20px;">
        <!--查询供应商-->
        <div class="row select-provider-form">
            <form class="form-inline" action="/showProvider">
                <div class="form-group">
                    <label for="providerName" class="provider-select-item">供应商</label>
                    <input type="text" class="form-control provider-select-item" id="providerName" name="name" value="" placeholder="请输入供应商的名称" required>
                    <input class="btn btn-primary provider-select-item" type="submit" value="查询"/>
                    <a class="btn btn-success provider-select-item" href="/addProviderHtml" role="button">添加供应商</a>
                </div>
            </form>
        </div>
        <!--供应商列表-->
        <div class="row provider-list">
            <table class="table table-bordered table-text">
                <thead>
                <tr>
                    <th scope="col">供应商编码</th>
                    <th scope="col">供应商名称</th>
                    <th scope="col">供应商联系人</th>
                    <th scope="col">供应商联系电话</th>
                    <th scope="col">供应商传真号</th>
<!--                    <th scope="col">创建日期</th>-->
                    <th scope="col">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="provider:${pageInfo.list}">
                    <td th:text="${provider.proid}">PRO-CODE—001</td>
                    <td th:text="${provider.proname}">测试供应商001</td>
                    <td th:text="${provider.procontact}">韩露</td>
                    <td th:text="${provider.prophone}">15918230478</td>
                    <td th:text="${provider.profax}">15918230478</td>
<!--                    <td th:text="${provider.creationdate}">2015-11-12</td>-->
                    <td>
                        <a class="btn btn-primary" th:href="@{/detailProvider(proid=${provider.proid})}"  role="button">查看</a>
                        <a class="btn btn-warning" th:href="@{/EditProviderHtml(id=${provider.proid})}" role="button">修改</a>
                        <a class="btn btn-danger" th:href="@{/deleteProvider(proid=${provider.proid})}" role="button" >删除</a>
                    </td>
                </tr>
                </tbody>
            </table>

            <!--分页-->
            <div class="page-div">
                共<span th:text="${pageInfo.total}">4</span>条记录，
                <span th:text="${pageInfo.pageNum}">1</span>/<span
                    th:text="${pageInfo.pages}">4</span>
                <a th:if="${pageInfo.pageNum}==1"
                   href="javascript:void(0)">上一页</a>
                <a href="#" th:if="${pageInfo.pageNum}!=1"
                   th:href="@{/showProvider(pageNum=${pageInfo.pageNum}-1)}">上一页</a>
                <span
                        th:each="i:${#numbers.sequence(1,pageInfo.pages)}">
               <a th:href="@{/showProvider(pageNum=${i})}"
                  th:text="${i}">1</a>
           </span>
                <a href="#"
                   th:if="${pageInfo.pageNum}!=${pageInfo.pages}"
                   th:href="@{/showProvider(pageNum=${pageInfo.pageNum}+1)}">下一页</a>
                <a
                        th:if="${pageInfo.pageNum}==${pageInfo.pages}"
                        href="javascript:void(0)">下一页</a>
            </div>

            <!--确认删除弹出框-->
            <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">提示</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            你确定要删除该供应商吗？
                        </div>
                        <div class="modal-footer">
                            <button id="no" type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                            <button id="yes" type="button" class="btn btn-primary">确定</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>

</body>
<script>

</script>

<style>

    .select-provider-form {
        margin-left: 50px;
    }

    .provider-select-item {
        margin-right: 40px;
    }

    .provider-list {
        width: 90%;
        margin-top: 20px;
        margin-left: 50px;
    }

    .table-text {
        text-align: center;
    }

    .page-div {
        margin-left: 65%;
    }

</style>
</html>